<%@ page contentType="text/html; charset=iso-8859-1" language="java" %>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
<%@ taglib uri="/struts-tags" prefix="s" %>
<%@ taglib uri="http://displaytag.sf.net/el" prefix="display" %>
<%@ include file="../inc/topo.jsp" %>
	<div id="breadcrumb">
		<s:text name="label.breadcrumb" />
		
		<a href="listarPagina.action">
			<s:text name="pagina.nome" />
		</a>  
		<s:text name="breadcrumb.separador" />
		<s:url id="voltar" action="listarPagina.action">
			<s:param name="pagina.nuPagina" value="pagina.nuPagina" />
		</s:url>
		
		<a href="listarConteudo.action"><s:text name="conteudo.nome" /></a>
	</div>	
	
	<br />  
	<h1><s:text name="label.listaDe" /><s:text name="conteudo.nome" /></h1><br />
	<s:set name="list" value="listConteudo" scope="request" />
	<c:set var="lblPagina"><s:text name="pagina.nome"></s:text></c:set>
	<c:set var="lblConteudo"><s:text name="conteudo.nome"></s:text></c:set>
	<c:set var="lblUsuario"><s:text name="usuario.nome"></s:text></c:set>
	
	<c:set var="lblTipoOrdenacao"><s:text name="label.tipo.ordenacao"></s:text></c:set>
	<c:set var="lblTitulo"><s:text name="label.titulo"></s:text></c:set>
	<c:set var="lblDataPublicacao"><s:text name="label.data.publicacao"></s:text></c:set>
	<c:set var="lblId"><s:text name="label.id"></s:text></c:set>
	
	<c:set var="lblEditarConfiguracao"><s:text name="label.editar.configuracao"></s:text></c:set>
	<c:set var="lblEditarItens"><s:text name="label.editar.conteudo.itens"></s:text></c:set>
	<s:url id="linkAdd" action="preAdicionarConteudo" />
	<s:a href="%{linkAdd}" accesskey="n"><b><s:text name="label.adicionar" /></b></s:a>
	<br/>
	<br/>
	<%@ include file="../inc/mensagens.jsp" %><br/>
	
	<form action="listarItensConteudo.action" method="get">
		<div class="formAlinhado">	
		 	<label for="buscarItemConteudo"><s:text name="conteudo.abrirPorCod" /></label>
			<s:textfield id="buscarItemConteudo" name="conteudo.nuConteudo" size="5"/>
			<input type="submit" value="Buscar" />
		</div>		
	</form>
	
	<form action="editarConteudo.action" method="get">
		<div class="formAlinhado">	
		 	<label for="editarConteudo"><s:text name="conteudo.editarPorCod" /></label>
			<s:textfield id="editarConteudo" name="conteudo.nuConteudo" size="5"/>
			<input type="submit" value="Buscar" />
		</div>		
	</form>
	
	<br />
	<div class="TbLEdit_Form"><br />
	<s:form action="buscarAdministrativo.action" >	
			<div class="TbLEdit_row">
				<label for="sbusca">
					<s:text name="buscar.nome" />:
				</label>
				<s:textfield name="texto" id="sbusca" />
				<s:submit name="btnBuscar" value="Buscar" cssClass="chk"/>
			</div>
			<div class="TbLEdit_btns">
				&nbsp;
			</div>
		</s:form>
		<span class="TbLEdit_msg">
			<s:fielderror/> 	 	
			<s:actionerror/>
			<s:actionmessage/>
			<s:property value="mensagem" />
		</span>
		<display:table name="list" id="row" requestURI="listarConteudo.action" pagesize="50">
			<display:column property="nuConteudo" title="cod" />
			<display:column title="#">
				<s:url id="editUrl" action="editarConteudo">
					<s:param name="conteudo.nuConteudo">${row.nuConteudo}</s:param>
				</s:url>
				<s:a href="%{editUrl}"><img src="images/engrenagem.gif" alt="${lblEditarConfiguracao} ${row.noConteudo}" /></s:a>
				|
				<!--  como retirar os parametros default do display tags? "d-16544-p" -->
				<s:url id="itens" action="listarItensConteudo">
					<s:param name="conteudo.nuConteudo" >${row.nuConteudo}</s:param>
					<s:param name="sgctb_conteudo.nu_conteudo">${row.nuConteudo}</s:param>
				</s:url>
				<a href="listarItensConteudo.action?conteudo.nuConteudo=${row.nuConteudo}&amp;sgctb_conteudo.nu_conteudo=${row.nuConteudo}"><img src="images/b_edit.png" alt="${lblEditarItens}" /></a>
			</display:column>			
			<display:column property="pagina.noTitulo" title="${lblPagina}" />
			<display:column property="noConteudo" title="${lblConteudo}" />
			<display:column property="tipoConteudo.noTipoConteudo" title="Tipo" />
			<display:column property="usuario.noUsuario" title="${lblUsuario}" />			 
			<display:column title="Ordem">
				<c:if test="${row.coOrdemDecrescente}">Decrescente</c:if>
				<c:if test="${!row.coOrdemDecrescente}">Crescente</c:if>
			</display:column>
			<display:column title="${lblTipoOrdenacao}">
				<c:if test="${empty row.nuTipoOrdenacao}">
					<s:text name="label.data.publicacao" />
				</c:if>
				<c:if test="${row.nuTipoOrdenacao == 1}">
					<s:text name="label.por.titulo" />
				</c:if>
				<c:if test="${row.nuTipoOrdenacao == 2}">
					<s:text name="label.id" />
				</c:if>
				<c:if test="${row.nuTipoOrdenacao == 3}">
					<s:text name="label.data.publicacao" />
				</c:if>
				<c:if test="${row.nuTipoOrdenacao == 4}">
					<s:text name="label.manual" />
				</c:if>
			</display:column>
			<display:column title="Visualizar" class="del">
				<a href="../?nu_pagina=${row.nuPagina}" onclick="window.open(this.href);return false;"><img src="images/lupa.png" alt="visualizar" /></a>
			</display:column>
			<display:column title="Apagar" style="text-align:center;">
				<s:url id="apagar" action="confirmarApagarConteudo">
					<s:param name="conteudo.nuConteudo">${row.nuConteudo}</s:param>
					<s:param name="nu_conteudo" >${row.nuConteudo}</s:param>
					<s:param name="toDel">${row.nuConteudo}</s:param>
					
				</s:url>
				<s:a href="%{apagar}"><img src="images/delete.gif" alt="Apagar ${row.noConteudo}" /></s:a>
			</display:column>
			
			<display:setProperty name="paging.banner.item_name">
				<s:text name="conteudo.nome" />
			</display:setProperty>
    		<display:setProperty name="paging.banner.items_name">
    			<s:text name="conteudo.nome" />s
    		</display:setProperty>
			<display:setProperty name="paging.banner.one_item_found">
		        <span class="pagebanner">Apenas 1 {0} encontrado</span>
		    </display:setProperty>
			<display:setProperty name="paging.banner.some_items_found">
		        <span class="pagebanner">{0} {1} encontrados, mostrando {2} at&eacute; {3}</span>
		    </display:setProperty>
		    <display:setProperty name="paging.banner.all_items_found">
	    		<span class\="pagebanner">{0} {1} encontrados, mostrando todos {2}.</span>
		    </display:setProperty>
		    <display:setProperty name="paging.banner.full">
				<span class="pagelinks">
		        [<a href="{1}">Primeira</a>/<a href="{2}">Anterior</a>]
		        {0}
		        [<a href="{3}">Pr&oacute;xima</a>/<a href="{4}">&Uacute;ltima</a>]
		        </span>
		    </display:setProperty>
		</display:table> 
	</div>
	<jsp:include page="../inc/final.jsp" />
